import java.util.ArrayList;
import java.util.List;

import org.apache.commons.httpclient.NameValuePair;
import org.apache.log4j.Logger;

import com.hivesight.infra.log4j.AppEngineSender;

class Sample {

	public static void main(String[] args) {
		//using the Log4J API
		Logger logger = Logger.getLogger("SampleJavaLogger");
		logger.info("This is an info message");
		logger.debug("This is a debug message");
        try {
            throw new RuntimeException("Runtime Exception");
        } catch (Exception e) {
            logger.error("And this is an error message", e);
        }

        
        //or directly calling the sender
		String loggerEndpoint = "http://logservertest.appspot.com/log";
		String apiKey = "hslogclient";
		String secretKey = "11235813";
		
		List<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new NameValuePair("app_name", "Java Client Test"));
		params.add(new NameValuePair("logger_name", "None"));
		params.add(new NameValuePair("message", "Testing 123"));
		params.add(new NameValuePair("severity", "INFO"));
		
		AppEngineSender.getInstance(apiKey, secretKey, loggerEndpoint).sendSilent(params);
        
        
	}

}